package ljl.alg.jianzhioffer.round2;

import java.util.LinkedList;

/*
* 没啥难的，解法也很单一
* */
public class _09_make_queue_with_two_stack {
    
    static class CQueue {
    
        LinkedList<Integer> stack1 = new LinkedList<>();
        LinkedList<Integer> stack2 = new LinkedList<>();
        
        public void appendTail(int value) {
            stack2.push(value);
        }
        
        public int deleteHead() {
            if (stack1.isEmpty()) {
                while (!stack2.isEmpty()) {
                    stack1.push(stack2.pop());
                }
            }
            if (stack1.isEmpty())
                return -1;
            return stack1.pop();
        }
    }
}
